<template>
    <div class="card"
        :style="{ 'width': width + 'px', 'height': height + 'px', 'borderRadius': `${borderRadius}px `, }">
        <router-link :to="`/details/${to}`" target="_blank">
            <div class="card-img"
                :style="{ 'height': imgHeight + 'px', 'borderRadius': `${borderRadius}px ${borderRadius}px 0 0` }">
                <img :src="pic" alt="" :style="{ 'borderRadius': `${borderRadius}px ${borderRadius}px 0 0` }"
                    class="zoom-image">
            </div>
            <div class="content" :style="{ 'height': height - imgHeight + 'px' }">
                <p class="clamp-line-2 title">{{ title }}</p>
                <p class="price" :style="{ 'text-align': direction }">￥<span class="price-num">{{ price }}</span>起</p>
            </div>
        </router-link>
    </div>
</template>

<script setup>
// 自定义卡片组件
import { ref, reactive, onMounted, computed } from "vue";

let { width, height, imgHeight, borderRadius, pic, title, price, to } = defineProps({
    'width': {
        type: [String, Number],
        default: '280',
    },
    'height': {
        type: [String, Number],
        default: '300',
    },
    'imgHeight': {
        type: [String, Number],
        default: '200',
    },
    "borderRadius": {
        type: [String, Number],
        default: '8',
    },
    'pic': {
        type: [String, Number],
        default: "https://admin.hqx.com.cn/Public/Uploads/Linelistpic/2024-07-04/66866eb86d07c.jpg",
    },
    'direction': {
        type: [String, Number],
        default: "right",
    },
    'title': {
        type: [String, Number],
        default: "【飞驰天山路】天山天池、禾木旅拍、可可托海畅玩新疆10天9晚可可托海畅玩新疆10天9晚可可托海畅玩新疆10天9晚可可托海畅玩新疆10天9晚",
    },
    'price': {
        type: [String, Number],
        default: '9876',
    },
    'to': {
        type: [String, Number],
        default: "/",
    }

})

</script>

<style lang="scss" scoped>
.card {
    position: relative;
    font-size: 18px;
    box-shadow: 0px 0px 23px 0px rgba(0, 0, 0, 0.08);
    // margin: 100px auto;
}

.card:hover {
    box-shadow: 0 12px 24px 0 rgba(15, 41, 77, .12);
}

.card-img {
    width: 100%;
    overflow: hidden;
}

.card-img>img {
    width: 100%;
    height: 100%;
}

.content {
    // height: 100px;
}

.title {
    height: 54px;
    font-size: 14px;
    font-family: PingFang SC, PingFang SC;
    color: #333333;
    // line-height: 18px;
    padding: 8px 10px 6px;
    box-sizing: border-box;
    margin-bottom: 6px;
}

.price {
    font-size: 10px;
    color: #FF1583;
    padding: 0 10px;
}

.price-num {
    font-size: 16px;
    font-weight: bold;
}




</style>